import Rx from "rxjs"

let foo = Rx.Observable.create(observer => {//这里的observer其实就是在subscribe的时候传入的对象或者函数。
    try {
      console.log('Hello');
      observer.next(42);
      observer.complete();
      observer.next(10);
    } catch(e) { observer.error(e) }
  });
  
  let observer = {
    complete() { console.log('completed')},
    next(value) { console.log(value) },
    error(err) { console.error(err) }
  }
  
  foo.subscribe(observer);//将observer传入到Observable

